package gov.dhs.cis.soa.data;

import gov.dhs.cis.soa.Constants;
import gov.dhs.cis.soa.Utils;
import gov.dhs.cis.soa.Constants.EntityType;

import java.sql.Timestamp;


public class Description extends AbstractSOAData {
	public static final Description DUMMY_DESC = new Description(Utils.getNextId(), "Not specified in XLS");
	
	public int id;
	public String descTxt;
	public transient Timestamp createdDt = new Timestamp(System.currentTimeMillis());
	public String type = Constants.getDescriptionType();
	
	public Description() {
		super();
	}
	
	public Description(EntityType type) {
		super();
		this.type = ""+type;
	}
	
	public Description(int dID, String descT) {
		super();
		id = dID;
		descTxt = descT;
	}
	
	@Override
	public String toString() {
		String ret = "";
		int limit = 25;
		if(!Utils.isEmpty(descTxt) && descTxt.length() > limit)
			ret = "Description [id=" + id + ", txt=" + descTxt.substring(0, limit) + "]";
		else
			ret = "Description [id=" + id + ", txt=" + descTxt + "]";
		return ret;
	}
	
//	public static String getUMLId(int entityId) {
//		return EntityType.DESC + "_" + entityId;
//	}
	
	@Override
	public long getId() {
		return id;
	}
	@Override
	public String getHashableId() {
		return descTxt;
	}

	@Override
	public EntityType getUMLType() {
		return EntityType.DESC;
	}
}
